package com.hq.door.service.impl;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

//import oracle.net.aso.a;

import com.hq.door.service.IAccessControlService;

public class AccessControlServiceImpl implements IAccessControlService {

	private ServerSocket serverSocket;

	@Override
	public void accessListen() {
		try {
			serverSocket = new ServerSocket(6000);
			while (true) {
				try {

					Socket socket = serverSocket.accept();
					InputStream iStream = socket.getInputStream();
					byte[] b = new byte[1000];
					iStream.read(b);

					for (int i = 0; i < b[1] * 16 * 16 + b[2] * 16 + b[3]; i++) {
						System.out.print(Integer.toHexString(b[i] & 0x000000FF)
								+ " ");
					}
					System.out.println();
				} catch (Exception e) {
					// TODO: handle exception
				}
			}

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public static void main(String[] args) {
		IAccessControlService accessControlService = new AccessControlServiceImpl();
		accessControlService.accessListen();
	}
}
